翻訳と辞書
Words near each other
・ C41
・ C41H26O26
・ C41H28O26
・ C41H28O27
・ C41H30O26
・ C2SV
・ C3
・ C3 (classification)
・ C3 (light novel)
・ C3 (railcar)
・ C3 carbon fixation
・ C3 Centauri
・ C3 Church Global
・ C3 Collaborating for Health
・ C3 convertase
C3 linearization
・ C3 policing
・ C3 Presents
・ C3 Racing
・ C3-convertase
・ C30
・ C300
・ C301
・ C30H17Cl
・ C30H18
・ C30H18O10
・ C30H24O12
・ C30H26O12
・ C30H26O13
・ C30H40O6


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

C3 linearization : ウィキペディア英語版
C3 linearization
In computing, the C3 superclass linearization is an algorithm used primarily to obtain the order in which methods should be inherited (the "linearization") in the presence of multiple inheritance, and is often termed "MRO" for Method Resolution Order. The name C3 refers to the three important properties of the resulting linearization: a consistent extended precedence graph, preservation of local precedence order, and fitting the monotonicity criterion. (The name "C3" is not an initialism.) It was first published at the 1996 OOPSLA conference, in a paper entitled "A Monotonic Superclass Linearization for Dylan". It was adapted to the Open Dylan implementation in January 2012〔(News item on opendylan.org )〕 following an enhancement proposal.〔(Dylan Enhancement Proposal 3: C3 superclass linearization )〕 It has been chosen as the default algorithm for method resolution in Python 2.3 (and newer),〔(Python 2.3's use of C3 MRO )〕〔(Tutorial for practical applications of C3 linearization using Python )〕 Perl 6,〔(Perl 6's use of the C3 MRO )〕 and Parrot.〔(Parrot uses C3 MRO )〕 It is also available as an alternative, non-default MRO in the core of Perl 5 starting with version 5.10.0.〔(C3 MRO available in Perl 5.10 and newer )〕 An extension implementation for earlier versions of Perl 5 named Class::C3 exists on CPAN.〔(Perl 5 extension for C3 MRO on CPAN )〕
== Description ==

The C3 superclass linearization of a class is the sum of the class plus a unique merge of the linearizations of its parents and a list of the parents itself. The list of parents as the last argument to the merge process preserves the local precedence order of direct parent classes.
The merge of parents' linearizations and parents list is done by selecting the first head of the lists which does not appear in the tail of any of the lists. Note, that a good head may appear as the first element in multiple lists at the same time, but it is forbidden to appear anywhere else. The selected element is removed from all the lists where it appears as a head and appended to the output list. The process of selecting and removing a good head to extend the output list is repeated until all remaining lists are exhausted. If at some point no good head can be selected, because the heads of all remaining lists appear in any one tail of the lists, then the merge is impossible to compute due to cyclic dependencies in the inheritance hierarchy and no linearization of the original class exists.
A naive divide and conquer approach to computing the linearization of a class may invoke the algorithm recursively to find the linearizations of parent classes for the merge-subroutine. However, this will result in an infinitely looping recursion in the presence of a cyclic class hierarchy. To detect such a cycle and to break the infinite recursion (and to reuse the results of previous computations as an optimization), the recursive invocation should be shielded against re-entrance of a previous argument by means of a cache or memoization.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「C3 linearization」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.